public class reflectTest {

    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException {
/*
        Class clz = Class.forName("com.mikechen.reflection.JiaGou");
        JiaGou jg= (JiaGou)clz.newInstance();

        Class clz2 = Class.forName("com.mikechen.reflection.JiaGou");
        Constructor constructor = clz.getConstructor();
        JiaGou jg2= (JiaGou)constructor.newInstance();*/
      /*  String a = "abc";
        String b = "abc";
        String a1 = new String("abc");
        String b1 = new String("abc");
        System.out.println(a == b);
        System.out.println(a == a1);
        System.out.println(a1 == b1);

*/

 /*       Integer a = 100;
        Integer b = 100;
        Integer a1 = 128;
        Integer bb = 128;
        System.out.println(a == b);//true
        System.out.println(a1 == bb);//false
*/


        int[] arr = { 1, 4, 62, 431, 2 };
        int sum = getSum(arr);
        System.out.println(sum);

        int sum2 = getSum(6, 7, 2, 12, 2121);
        System.out.println(sum2);


    }
    //可变参数写法
    public static int getSum(int... arr) {
        int sum = 0;
        for (int a : arr) {
            sum += a;
        }
        return sum;
    }


}
